package com.thlws.redis.pubsub;

import redis.clients.jedis.Jedis;

/**
 * @author HanleyTang
 * @date 2018-12-15
 */
public class JedisPub {

    public static void main(String[] args) throws Exception {

        try(Jedis jedis = new Jedis("localhost",6379);){

            //间隔1s发布消息
            for (int i=0; i<10; i++){
                jedis.publish("cctv", "welcome - " + i);
                Thread.sleep(1000);
            }
        }
    }
}
